package com.wjk.cms.pojo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.CreationTimestamp;

import javax.persistence.*;
import java.util.Date;

/**
 * @description: 王浆卡
 * @author WUGN
 * @date 2021/1/6 11:55
 * @version 1.0
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Entity
@JsonIgnoreProperties(value = {"hibernateLazyInitializer", "handler"})
@Table(
        name = "t_card"
)
public class Card extends BaseEntity {


    @Column(columnDefinition = "varchar(20)  COMMENT '卡号'")
    private String code;

    @Column(columnDefinition = "int(11)  COMMENT '状态 （0正常 1领取  2已激活 3已提取 4已发货）' default 0")
    private Integer status=0;

    @Column(columnDefinition = "bigint  COMMENT '卡类型id'")
    private Long categoryId;

    @Column(columnDefinition = "bigint  COMMENT '经销商id'")
    private Long userId;

    @Column(columnDefinition = "bigint  COMMENT '客户id'")
    private Long customerId;

    @Column(columnDefinition = "varchar(20)  COMMENT '价格'")
    private String password;

    @Column(columnDefinition = "varchar(20)  COMMENT '收货人姓名'")
    private String receiverName;

    @Column(columnDefinition = "varchar(20)  COMMENT '收货人电话'")
    private String receiverPhone;

    @Column(columnDefinition = "varchar(200)  COMMENT '备注'")
    private String remark;

    @Column(columnDefinition = "varchar(500)  COMMENT '地址'")
    private String address;

    @ManyToOne
    @JoinColumn(name = "categoryId", referencedColumnName = "id", insertable = false, updatable = false)
    private Category category;

    @Column(columnDefinition = "varchar(100)  COMMENT '运单号'")
    private String trackingNumber;

    @Column(columnDefinition = "varchar(20)  COMMENT '快递公司'")
    private String sender;

    @Transient
    private String statusText;

    @Column(columnDefinition = "datetime COMMENT '激活时间'")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date activeTime;

    @Transient
    private String orderCode;


}
